package utilityClasses;

/**
 * Class Timer is used to measure time spent on evaluated code
 */

public class Timer {

	// Gets the start time in a long value
	public static long startTime() {
		long start = System.nanoTime();
		return start;
	}

	// Gets the current time minus the start time rounded = the time spent
	public static long getTime(long start) {
		long total = System.nanoTime() - start;
		long rounded = ((total + 500000) / 1000000);
		return rounded;
	}

	// Prints out the time
	public static void printTime(long rounded) {
		System.out.println("Total time spent: " + rounded + " milliseconds");
	}
}
